<template>
  <div class="container">
    <data-view
      propViewKey="base_warehouse"
      propViewForm="base/warehouse/detail.vue"
      :propIsTdesign="true"
      @extra-button-click="handleExtraButtonClick"
      ref="dataView"
    />
  </div>
</template>

<script>

export default {
  name: 'warehouse',
  data() {
    return {

    }
  },
  components: {

  },
  methods: {
    handleExtraButtonClick(para) {
      if (para.button.key == 'creatByDept') {
        this.utilMessage.confirm('是否创建科室？将对没有默认仓库并且未禁用的科室创建相关仓库并进行绑定', () => {
          this.utilVue.loadShow(true)
          this.$ajax.get('/base/warehouse/creatByDept').then(response => {
            this.utilVue.loadHide()
            if (response.code == 0) {
              this.utilMessage.success(response.msg)
              this.$refs.dataView.fetchData()
            }
          })
        })

      }
    }
  }
}
</script>

<style lang="scss" scoped>
  .container {
    height: 100%;
    background-color: #fff;
  }
</style>
